function goToStory() {
  // 点击“点开始”按钮后跳转
  window.location.href = "story.html"; // 记得添加这个页面
}

document.addEventListener('click', e => {
  const t = document.createElement('span');
  t.classList.add('floating-heart');
  t.textContent = '❤️';
  t.style.left = e.clientX + 'px';
  t.style.top = e.clientY + 'px';
  document.body.appendChild(t);
  setTimeout(() => t.remove(), 2000);
});

function createHeartRain() {
  const t = document.querySelector('.heart-rain');
  const n = ['💖','💗','💕','🥰','','💘','💟','💞','💌','🤍'];
  for (let r = 0; r < 15; r++) {
    const i = document.createElement('span');
    i.classList.add('falling-heart');
    const c = Math.floor(Math.random() * n.length);
    i.textContent = n[c];
    i.style.left = Math.random() * 100 + '%';
    i.style.animationDuration = Math.random() * 5 + 3 + 's';
    i.style.setProperty('--x-offset', (Math.random() - 0.5) * 200 + 'px');
    t.appendChild(i);
  }
}
window.addEventListener('load', createHeartRain);
